//    Copyright (C) Kherty.  All rights reserved.
using System.ComponentModel;
using System.Globalization;
using OpenLS.Spreadsheet.UI.Internals;
using OpenLS.Spreadsheet.UI.Internals.Resources;

namespace OpenLS.Spreadsheet.UI
{
    public class ColorGrouping : GroupDescription
    {
        public override object GroupNameFromItem(object item, int level, CultureInfo culture)
        {
            if (item == null)
                return UIStringTable.DefaultColor; 
            if (item is PatternFill)
                item = ((PatternFill) item).GetColor();
            {
                SpreadsheetColor colorRef = (SpreadsheetColor)item;
                if (colorRef is ThemeColor)
                    return UIStringTable.ThemeColor; //\\"Theme Color";
                if (colorRef is RgbColor)
                    return UIStringTable.StandardColor;
            }
            return UIStringTable.Other;
        }
    }
}